<?php

class StreamUrl
{
    protected $domain;
    protected $path;
    protected $endtime;
    protected $key;

    function __construct($domain,$path,$endtime,$key)
    {
        $this->domain = $domain;
        $this->path = $path;   
        $this->endtime= $endtime;   
        $this->key = $key;   

    }
    function rtmp()
    {
        return "rtmp://{$this->domain}{$this->path}?txSecret={$this->key}&txTime={$this->endtime}";
    }

    function json()
    {
        
    }

    function __toString()
    {
        return $this->rtmp();
    }
}